package org.reenscape.remote;
import java.net.*;
import java.io.*;
/**
*@author Troy Osborne
*/
public class Listener implements Runnable {

	public Listener() {
			try {
					serversocket = new ServerSocket(23);
					System.out.println("[TEL]Telnet server started on port 23.");
			} catch (Exception _ex){
					System.out.println("[TEL]Could not start Telnet server on port 23.");
					System.exit(2);
			}
	}

	public void run() {
			try {
				while(true) {
					Socket socket = serversocket.accept();
					Communicator co = new Communicator(socket);
					new Thread(co).start();
				}
			} catch(Exception _ex) { 
				System.out.println("[TEL]Could not start Telnet server on port 23.");
				System.exit(2);
			}
	}

	public ServerSocket serversocket;

}